package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseUser;
import com.briup.recognition.bean.BaseUserExample;
import com.briup.recognition.dao.BaseUserMapper;
import com.briup.recognition.service.IBaseUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BaseUserServiceImpl implements IBaseUserService {

    @Resource
    private BaseUserMapper baseUserMapper;

    @Override
    public List<BaseUser> query(){
        BaseUserExample example = new BaseUserExample();
        return baseUserMapper.selectByExample(example);
    }
    @Override
    public void saveOrUpdate(BaseUser baseUser){
        if (baseUser.getId()!=null){
            baseUserMapper.updateByPrimaryKey(baseUser);
        }else {
            baseUserMapper.insert(baseUser);
        }
    }

    @Override
    public void deleteById(long id){
        baseUserMapper.deleteByPrimaryKey(id);
    }

}
